gail: use a weak pointer instead of an invalid destroy signal
authorWilliam Jon McCann <jmccann@redhat.com>
Sat, 2 Oct 2010 19:45:46 +0000 (15:45 -0400)
committerWilliam Jon McCann <jmccann@redhat.com>
Sat, 2 Oct 2010 19:45:46 +0000 (15:45 -0400)
modules/other/gail/gailadjustment.c

index 522648831276ed583578021c8b9752a3b2f5323f..0a5a9c0c8077c59838620df6cd6f14a92bf4bae4 100644 (file)
@@ -43,9 +43,6 @@ static void    gail_adjustment_get_minimum_increment (AtkValue        *obj,
 static gboolean         gail_adjustment_set_current_value (AtkValue            *obj,
                                                     const GValue        *value);
 
-static void      gail_adjustment_destroyed         (GtkAdjustment       *adjustment,
-                                                    GailAdjustment      *gail_adjustment);
-
 G_DEFINE_TYPE_WITH_CODE (GailAdjustment, gail_adjustment, ATK_TYPE_OBJECT,
                          G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
 
@@ -83,18 +80,18 @@ gail_adjustment_real_initialize (AtkObject *obj,
                                  gpointer  data)
 {
   GtkAdjustment *adjustment;
+  GailAdjustment *gail_adjustment;
 
   ATK_OBJECT_CLASS (gail_adjustment_parent_class)->initialize (obj, data);
 
   adjustment = GTK_ADJUSTMENT (data);
 
   obj->role = ATK_ROLE_UNKNOWN;
-  GAIL_ADJUSTMENT (obj)->adjustment = adjustment;
+  gail_adjustment = GAIL_ADJUSTMENT (obj);
+  gail_adjustment->adjustment = adjustment;
 
-  g_signal_connect_object (G_OBJECT (adjustment),
-                           "destroy",
-                           G_CALLBACK (gail_adjustment_destroyed),
-                           obj, 0);
+  g_object_add_weak_pointer (G_OBJECT (adjustment),
+                             (gpointer *) &gail_adjustment->adjustment);
 }
 
 static void     
@@ -231,14 +228,3 @@ gail_adjustment_set_current_value (AtkValue             *obj,
   else
     return FALSE;
 }
-
-static void
-gail_adjustment_destroyed (GtkAdjustment       *adjustment,
-                           GailAdjustment      *gail_adjustment)
-{
-  /*
-   * This is the signal handler for the "destroy" signal for the 
-   * GtkAdjustment. We set the  pointer location to NULL;
-   */
-  gail_adjustment->adjustment = NULL;
-}